home *** CD-ROM | disk | FTP | other *** search
- head 1.1;
- branch ;
- access ;
- symbols ;
- locks mendel:1.1; strict;
- comment @| @;
-
-
- 1.1
- date 89.06.19.14.16.19; author mendel; state Exp;
- branches ;
- next ;
-
-
- desc
- @@
-
-
-
- 1.1
- log
- @Initial revision
- @
- text
- @!
- ! .seg "data"
- ! .asciz "@@(#)map.s 1.5 88/02/08"
- ! Copyright (c) 1986 by Sun Microsystems, Inc.
- !
-
- !
- ! Memory Mapping for Sun 4
- !
- ! The following subroutines accept any address in the mappable range
- ! (256 megs). They access the map for the current context register. They
- ! assume that currently we are running in supervisor state.
- !
- ASI_SM=3 ! address spaces indentifier for segment map
- ASI_PM=4 ! address spaces indentifier for page map
- SEGMENTADDRBITS=0xFFFC0000 ! relevant bits of a segment in vitrual address
-
- .seg "text"
-
- !
- ! Read the page map entry for the given address v
- ! and return it in a form suitable for software use.
- !
- ! long
- ! getpgmap(v)
- ! caddr_t v;
- !
- .global _getpgmap
- _getpgmap:
- andn %o0,0x3,%o1 ! align to word boundary
- lda [%o1]ASI_PM,%o0 ! read page map entry
- retl
- nop ! nop hack needed for proto 1 XXXX
-
- !
- ! Set the pme for address v using the software pte given.
- !
- ! setpgmap(v, pte)
- ! caddr_t v;
- ! long pte;
- !
- .global _setpgmap
- _setpgmap:
- andn %o0,0x3,%o2 ! align to word boundary
- retl
- sta %o1,[%o2]ASI_PM ! write page map entry
-
- !
- ! Set the segment map entry for segno to pm.
- !
- ! setsegmap(v, pm)
- ! u_int segno;
- ! u_short pm;
- !
- .global _setsegmap
- _setsegmap:
- set SEGMENTADDRBITS, %o2
- and %o0, %o2, %o0 ! get relevant segment address bits
- retl
- stha %o1,[%o0]ASI_SM ! write segment entry
- /*
- * Get the segment map entry for ther given virtual address
- *
- * getsegmap(v)
- * caddr_t vaddr;
- */
- .global _getsegmap
- _getsegmap:
- set SEGMENTADDRBITS, %o2
- and %o0, %o2, %o0 ! get relevant segment address bits
- lduha [%o0]ASI_SM,%o0 ! read segment entry
- set _segmask, %o2 ! need to mask bits due to bug in cobra
- ld [%o2], %o2
- retl
- and %o0, %o2, %o0
- @
-